package com.sgb.kjwl.pop;
import android.content.Context;
import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.Bean;
import com.sgb.kjwl.view.ui.adapter.home.SelectAdapter;
import com.sgb.kjwl.view.widget.MaxHeightRecyclerView;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.dialog.PopViewHolder;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;

import java.util.List;

public class TeamForEnterpisePopWindow extends BasePopWindow {
    public int mType;
    public SelectAdapter mAdapter;
    private MaxHeightRecyclerView recyclerView;
    private View view;
    public Bean mBean;
    public boolean mIsClick;

    public TeamForEnterpisePopWindow(Context context) {
        super(context);
    }

    @Override
    protected int popLayout() {
        return R.layout.need_popwindow;
    }

    @Override
    protected void initView(PopViewHolder holder) {
        recyclerView = holder.getPop().findViewById(R.id.goods_type_list);
        view = holder.getPop().findViewById(R.id.bg_pop_gray_layout);
        setBgView(view);
        mAdapter = new SelectAdapter(mContext, null);
        mAdapter.getCheckDatas();
        mAdapter.setItemSelect(true);
        mAdapter.setDefItem(0);
        recyclerView.setLayoutManager(new GridLayoutManager(mContext, 4));
        recyclerView.setAdapter(mAdapter);

        mAdapter.setOnItemClick(new AdapterOnItemClick<Bean>() {
            @Override
            public void onItemClick(Bean bean, int position) {
                mBean = bean;
                mIsClick = true;

                if (onResultClick != null)
                    onResultClick.result(bean, position, null);
                dissMiss();
            }
        });


    }

    public void setData(List<Bean> list) {
        mAdapter.setDatas(list);
    }



}
